<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
  <title>修改二级学科</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f5f1ff;
      color: #4e3d63;
      margin: 0;
      padding: 0;
    }
    .container {
      width: 80%;
      margin: 0 auto;
      padding: 20px;
      background-color: #ffffff;
      border-radius: 8px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    h1 {
      text-align: center;
      color: #7a4e9f;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 20px;
    }
    table th, table td {
      padding: 12px;
      text-align: center;
      border: 1px solid #ddd;
    }
    table th {
      background-color: #d9c8e2;
    }
    button {
      padding: 8px 16px;
      margin: 5px;
      border: none;
      background-color: #7a4e9f;
      color: white;
      cursor: pointer;
      border-radius: 4px;
    }
    button:hover {
      background-color: #9b8fa6;
    }
  </style>
</head>
<body>
<div class="container">
  <h1>修改二级学科</h1>

  <a href="/department_head_view/addSecondaryDiscipline.jsp"><button>添加二级学科</button></a>

  <c:forEach var="primaryDiscipline" items="${sessionScope.pdi_list}">
    <h2>${primaryDiscipline.primaryDisciplineId} - ${primaryDiscipline.name}</h2>

    <table>
      <thead>
      <tr>
        <th>二级学科ID</th>
        <th>二级学科名称</th>
        <th>描述</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <c:forEach var="secondaryDiscipline" items="${primaryDiscipline.secondaryDisciplineStaticInfos}">
        <tr>
          <td>${secondaryDiscipline.secondaryDisciplineId}</td>
          <td>${secondaryDiscipline.name}</td>
          <td>${secondaryDiscipline.details}</td>
          <td>
            <a href="/department_head_view/editSecondaryDisciplineDetails.jsp?id=${secondaryDiscipline.secondaryDisciplineId}">
              <button>编辑</button>
            </a>
            <form action="/department_head_view/deleteSecondaryDiscipline" method="post" style="display:inline;">
              <input type="hidden" name="id" value="${secondaryDiscipline.secondaryDisciplineId}" />
              <button type="submit">删除</button>
            </form>
          </td>
        </tr>
      </c:forEach>
      </tbody>
    </table>
  </c:forEach>
</div>
</body>
</html>